package com.u3k.app.mid.core.adapi;

import android.content.Context;
import com.u3k.app.mid.core.ModuleApiManager;
import com.u3k.mid.LogUtils;

import java.lang.reflect.Method;

public class Convertor {
    static String TAG = "ListenerConvertor";

    /* renamed from: com.u3k.app.mid.core.adapi.Convertor$1 */
    final class AnonymousClass1 implements IAdListener {
        final /* synthetic */ Context val$ctx;
        final /* synthetic */ Object val$shellInstance;
        final /* synthetic */ Object val$shellListener;

        AnonymousClass1(Context context, Object obj, Object obj2) {
            this.val$ctx = context;
            this.val$shellListener = obj;
            this.val$shellInstance = obj2;
        }

        public void onAdClicked(IAd iAd) {
            try {
                LogUtils.LogError(Convertor.TAG, "onAdClicked");
                String publicApiInterfaceMethodName = ModuleApiManager.getInstance(this.val$ctx).getPublicApiInterfaceMethodName("IAdListener.onAdClicked");
                for (Method method : this.val$shellListener.getClass().getMethods()) {
                    if (method.getName().equals(publicApiInterfaceMethodName)) {
                        method.setAccessible(true);
                        method.invoke(this.val$shellListener, new Object[]{this.val$shellInstance});
                        return;
                    }
                }
            } catch (Exception e) {
                LogUtils.LogError(Convertor.TAG, "onAdClicked Exception=" + e);
            }
        }

        public void onAdLoaded(IAd iAd) {
            try {
                LogUtils.LogError(Convertor.TAG, "onAdLoaded");
                String publicApiInterfaceMethodName = ModuleApiManager.getInstance(this.val$ctx).getPublicApiInterfaceMethodName("IAdListener.onAdLoaded");
                for (Method method : this.val$shellListener.getClass().getMethods()) {
                    if (method.getName().equals(publicApiInterfaceMethodName)) {
                        method.setAccessible(true);
                        method.invoke(this.val$shellListener, new Object[]{this.val$shellInstance});
                        return;
                    }
                }
            } catch (Exception e) {
                LogUtils.LogError(Convertor.TAG, "onAdLoaded Exception=" + e);
            }
        }

        public void onError(IAd iAd, int i, String str) {
            try {
                LogUtils.LogError(Convertor.TAG, "onError errorCode=" + i + ", errorMsg=" + str);
                String publicApiInterfaceMethodName = ModuleApiManager.getInstance(this.val$ctx).getPublicApiInterfaceMethodName("IAdListener.onError");
                for (Method method : this.val$shellListener.getClass().getMethods()) {
                    if (method.getName().equals(publicApiInterfaceMethodName)) {
                        method.setAccessible(true);
                        method.invoke(this.val$shellListener, new Object[]{this.val$shellInstance, Integer.valueOf(i), str});
                        return;
                    }
                }
            } catch (Exception e) {
                LogUtils.LogError(Convertor.TAG, "onError Exception=" + e);
            }
        }

        public void onLoggingImpression(IAd iAd) {
            try {
                LogUtils.LogError(Convertor.TAG, "onLoggingImpression");
                String publicApiInterfaceMethodName = ModuleApiManager.getInstance(this.val$ctx).getPublicApiInterfaceMethodName("IAdListener.onLoggingImpression");
                for (Method method : this.val$shellListener.getClass().getMethods()) {
                    if (method.getName().equals(publicApiInterfaceMethodName)) {
                        method.setAccessible(true);
                        method.invoke(this.val$shellListener, new Object[]{this.val$shellInstance});
                        return;
                    }
                }
            } catch (Exception e) {
                LogUtils.LogError(Convertor.TAG, "onLoggingImpression Exception=" + e);
            }
        }
    }

    /* renamed from: com.u3k.app.mid.core.adapi.Convertor$2 */
    final class AnonymousClass2 implements INativeAdListener {
        final /* synthetic */ Context val$ctx;
        final /* synthetic */ Object val$shellInstance;
        final /* synthetic */ Object val$shellListener;

        AnonymousClass2(Context context, Object obj, Object obj2) {
            this.val$ctx = context;
            this.val$shellListener = obj;
            this.val$shellInstance = obj2;
        }

        public void onAdClicked(IAd iAd) {
            try {
                LogUtils.LogError(Convertor.TAG, "onAdClicked");
                String publicApiInterfaceMethodName = ModuleApiManager.getInstance(this.val$ctx).getPublicApiInterfaceMethodName("IAdListener.onAdClicked");
                for (Method method : this.val$shellListener.getClass().getMethods()) {
                    if (method.getName().equals(publicApiInterfaceMethodName)) {
                        method.setAccessible(true);
                        method.invoke(this.val$shellListener, new Object[]{this.val$shellInstance});
                        return;
                    }
                }
            } catch (Exception e) {
                LogUtils.LogError(Convertor.TAG, "onAdClicked Exception=" + e);
            }
        }

        public void onAdLoaded(IAd iAd) {
            try {
                LogUtils.LogError(Convertor.TAG, "onAdLoaded");
                String publicApiInterfaceMethodName = ModuleApiManager.getInstance(this.val$ctx).getPublicApiInterfaceMethodName("IAdListener.onAdLoaded");
                for (Method method : this.val$shellListener.getClass().getMethods()) {
                    if (method.getName().equals(publicApiInterfaceMethodName)) {
                        method.setAccessible(true);
                        method.invoke(this.val$shellListener, new Object[]{this.val$shellInstance});
                        return;
                    }
                }
            } catch (Exception e) {
                LogUtils.LogError(Convertor.TAG, "onAdLoaded Exception=" + e);
            }
        }

        public void onError(IAd iAd, int i, String str) {
            try {
                LogUtils.LogError(Convertor.TAG, "onError errorCode=" + i + ", errorMsg=" + str);
                String publicApiInterfaceMethodName = ModuleApiManager.getInstance(this.val$ctx).getPublicApiInterfaceMethodName("IAdListener.onError");
                for (Method method : this.val$shellListener.getClass().getMethods()) {
                    if (method.getName().equals(publicApiInterfaceMethodName)) {
                        method.setAccessible(true);
                        method.invoke(this.val$shellListener, new Object[]{this.val$shellInstance, Integer.valueOf(i), str});
                        return;
                    }
                }
            } catch (Exception e) {
                LogUtils.LogError(Convertor.TAG, "onError Exception=" + e);
            }
        }

        public void onLoggingImpression(IAd iAd) {
            try {
                LogUtils.LogError(Convertor.TAG, "onLoggingImpression");
                String publicApiInterfaceMethodName = ModuleApiManager.getInstance(this.val$ctx).getPublicApiInterfaceMethodName("IAdListener.onLoggingImpression");
                for (Method method : this.val$shellListener.getClass().getMethods()) {
                    if (method.getName().equals(publicApiInterfaceMethodName)) {
                        method.setAccessible(true);
                        method.invoke(this.val$shellListener, new Object[]{this.val$shellInstance});
                        return;
                    }
                }
            } catch (Exception e) {
                LogUtils.LogError(Convertor.TAG, "onLoggingImpression Exception=" + e);
            }
        }

        public void onMediaDownloaded(IAd iAd) {
            try {
                LogUtils.LogError(Convertor.TAG, "onMediaDownloaded");
                String publicApiInterfaceMethodName = ModuleApiManager.getInstance(this.val$ctx).getPublicApiInterfaceMethodName("INativeAdListener.onMediaDownloaded");
                for (Method method : this.val$shellListener.getClass().getMethods()) {
                    if (method.getName().equals(publicApiInterfaceMethodName)) {
                        method.setAccessible(true);
                        method.invoke(this.val$shellListener, new Object[]{this.val$shellInstance});
                        return;
                    }
                }
            } catch (Exception e) {
                LogUtils.LogError(Convertor.TAG, "onMediaDownloaded Exception=" + e);
            }
        }
    }

    /* renamed from: com.u3k.app.mid.core.adapi.Convertor$3 */
    final class AnonymousClass3 implements IInterstitialAdListener {
        final /* synthetic */ Context val$ctx;
        final /* synthetic */ Object val$shellInstance;
        final /* synthetic */ Object val$shellListener;

        AnonymousClass3(Context context, Object obj, Object obj2) {
            this.val$ctx = context;
            this.val$shellListener = obj;
            this.val$shellInstance = obj2;
        }

        public void onAdClicked(IAd iAd) {
            try {
                LogUtils.LogError(Convertor.TAG, "IInterstitialAdListener.onAdClicked");
                String publicApiInterfaceMethodName = ModuleApiManager.getInstance(this.val$ctx).getPublicApiInterfaceMethodName("IInterstitialAdListener.onAdClicked");
                for (Method method : this.val$shellListener.getClass().getMethods()) {
                    if (method.getName().equals(publicApiInterfaceMethodName)) {
                        method.setAccessible(true);
                        method.invoke(this.val$shellListener, new Object[]{this.val$shellInstance});
                        return;
                    }
                }
            } catch (Exception e) {
                LogUtils.LogError(Convertor.TAG, "IInterstitialAdListener.onAdClicked Exception=" + e);
            }
        }

        public void onAdLoaded(IAd iAd) {
            try {
                LogUtils.LogError(Convertor.TAG, "IInterstitialAdListener.onAdLoaded");
                String publicApiInterfaceMethodName = ModuleApiManager.getInstance(this.val$ctx).getPublicApiInterfaceMethodName("IInterstitialAdListener.onAdLoaded");
                for (Method method : this.val$shellListener.getClass().getMethods()) {
                    if (method.getName().equals(publicApiInterfaceMethodName)) {
                        method.setAccessible(true);
                        method.invoke(this.val$shellListener, new Object[]{this.val$shellInstance});
                        return;
                    }
                }
            } catch (Exception e) {
                LogUtils.LogError(Convertor.TAG, "IInterstitialAdListener.onAdLoaded Exception=" + e);
            }
        }

        public void onError(IAd iAd, int i, String str) {
            try {
                LogUtils.LogError(Convertor.TAG, "IInterstitialAdListener.onError code=" + i + ", msg=" + str);
                String publicApiInterfaceMethodName = ModuleApiManager.getInstance(this.val$ctx).getPublicApiInterfaceMethodName("IInterstitialAdListener.onError");
                for (Method method : this.val$shellListener.getClass().getMethods()) {
                    if (method.getName().equals(publicApiInterfaceMethodName)) {
                        method.setAccessible(true);
                        method.invoke(this.val$shellListener, new Object[]{this.val$shellInstance, Integer.valueOf(i), str});
                        return;
                    }
                }
            } catch (Exception e) {
                LogUtils.LogError(Convertor.TAG, "IInterstitialAdListener.onError Exception=" + e);
            }
        }

        public void onInterstitialDismissed(IAd iAd) {
            try {
                LogUtils.LogError(Convertor.TAG, "IInterstitialAdListener.onInterstitialDismissed");
                String publicApiInterfaceMethodName = ModuleApiManager.getInstance(this.val$ctx).getPublicApiInterfaceMethodName("IInterstitialAdListener.onInterstitialDismissed");
                for (Method method : this.val$shellListener.getClass().getMethods()) {
                    if (method.getName().equals(publicApiInterfaceMethodName)) {
                        method.setAccessible(true);
                        method.invoke(this.val$shellListener, new Object[]{this.val$shellInstance});
                        return;
                    }
                }
            } catch (Exception e) {
                LogUtils.LogError(Convertor.TAG, "IInterstitialAdListener.onInterstitialDismissed Exception=" + e);
            }
        }

        public void onInterstitialDisplayed(IAd iAd) {
            try {
                LogUtils.LogError(Convertor.TAG, "IInterstitialAdListener.onInterstitialDisplayed");
                String publicApiInterfaceMethodName = ModuleApiManager.getInstance(this.val$ctx).getPublicApiInterfaceMethodName("IInterstitialAdListener.onInterstitialDisplayed");
                for (Method method : this.val$shellListener.getClass().getMethods()) {
                    if (method.getName().equals(publicApiInterfaceMethodName)) {
                        method.setAccessible(true);
                        method.invoke(this.val$shellListener, new Object[]{this.val$shellInstance});
                        return;
                    }
                }
            } catch (Exception e) {
                LogUtils.LogError(Convertor.TAG, "IInterstitialAdListener.onInterstitialDisplayed Exception=" + e);
            }
        }

        public void onLoggingImpression(IAd iAd) {
            try {
                LogUtils.LogError(Convertor.TAG, "IInterstitialAdListener.onLoggingImpression");
                String publicApiInterfaceMethodName = ModuleApiManager.getInstance(this.val$ctx).getPublicApiInterfaceMethodName("IInterstitialAdListener.onLoggingImpression");
                for (Method method : this.val$shellListener.getClass().getMethods()) {
                    if (method.getName().equals(publicApiInterfaceMethodName)) {
                        method.setAccessible(true);
                        method.invoke(this.val$shellListener, new Object[]{this.val$shellInstance});
                        return;
                    }
                }
            } catch (Exception e) {
                LogUtils.LogError(Convertor.TAG, "IInterstitialAdListener.onLoggingImpression Exception=" + e);
            }
        }
    }

    /* renamed from: com.u3k.app.mid.core.adapi.Convertor$4 */
    final class AnonymousClass4 implements IMediaViewListener {
        final /* synthetic */ Context val$ctx;
        final /* synthetic */ Object val$shellInstance;
        final /* synthetic */ Object val$shellListener;

        AnonymousClass4(Context context, Object obj, Object obj2) {
            this.val$ctx = context;
            this.val$shellListener = obj;
            this.val$shellInstance = obj2;
        }

        public void onComplete(IMediaView iMediaView) {
            try {
                LogUtils.LogError(Convertor.TAG, "IMediaViewListener.onComplete");
                String publicApiInterfaceMethodName = ModuleApiManager.getInstance(this.val$ctx).getPublicApiInterfaceMethodName("IMediaViewListener.onComplete");
                for (Method method : this.val$shellListener.getClass().getMethods()) {
                    if (method.getName().equals(publicApiInterfaceMethodName)) {
                        method.setAccessible(true);
                        method.invoke(this.val$shellListener, new Object[]{this.val$shellInstance});
                        return;
                    }
                }
            } catch (Exception e) {
                LogUtils.LogError(Convertor.TAG, "IMediaViewListener.onComplete Exception=" + e);
            }
        }

        public void onEnterFullscreen(IMediaView iMediaView) {
            try {
                LogUtils.LogError(Convertor.TAG, "IMediaViewListener.onEnterFullscreen");
                String publicApiInterfaceMethodName = ModuleApiManager.getInstance(this.val$ctx).getPublicApiInterfaceMethodName("IMediaViewListener.onEnterFullscreen");
                for (Method method : this.val$shellListener.getClass().getMethods()) {
                    if (method.getName().equals(publicApiInterfaceMethodName)) {
                        method.setAccessible(true);
                        method.invoke(this.val$shellListener, new Object[]{this.val$shellInstance});
                        return;
                    }
                }
            } catch (Exception e) {
                LogUtils.LogError(Convertor.TAG, "IMediaViewListener.onEnterFullscreen Exception=" + e);
            }
        }

        public void onExitFullscreen(IMediaView iMediaView) {
            try {
                LogUtils.LogError(Convertor.TAG, "IMediaViewListener.onExitFullscreen");
                String publicApiInterfaceMethodName = ModuleApiManager.getInstance(this.val$ctx).getPublicApiInterfaceMethodName("IMediaViewListener.onExitFullscreen");
                for (Method method : this.val$shellListener.getClass().getMethods()) {
                    if (method.getName().equals(publicApiInterfaceMethodName)) {
                        method.setAccessible(true);
                        method.invoke(this.val$shellListener, new Object[]{this.val$shellInstance});
                        return;
                    }
                }
            } catch (Exception e) {
                LogUtils.LogError(Convertor.TAG, "IMediaViewListener.onExitFullscreen Exception=" + e);
            }
        }

        public void onFullscreenBackground(IMediaView iMediaView) {
            try {
                LogUtils.LogError(Convertor.TAG, "IMediaViewListener.onFullscreenBackground");
                String publicApiInterfaceMethodName = ModuleApiManager.getInstance(this.val$ctx).getPublicApiInterfaceMethodName("IMediaViewListener.onFullscreenBackground");
                for (Method method : this.val$shellListener.getClass().getMethods()) {
                    if (method.getName().equals(publicApiInterfaceMethodName)) {
                        method.setAccessible(true);
                        method.invoke(this.val$shellListener, new Object[]{this.val$shellInstance});
                        return;
                    }
                }
            } catch (Exception e) {
                LogUtils.LogError(Convertor.TAG, "IMediaViewListener.onFullscreenBackground Exception=" + e);
            }
        }

        public void onFullscreenForeground(IMediaView iMediaView) {
            try {
                LogUtils.LogError(Convertor.TAG, "IMediaViewListener.onFullscreenForeground");
                String publicApiInterfaceMethodName = ModuleApiManager.getInstance(this.val$ctx).getPublicApiInterfaceMethodName("IMediaViewListener.onFullscreenForeground");
                for (Method method : this.val$shellListener.getClass().getMethods()) {
                    if (method.getName().equals(publicApiInterfaceMethodName)) {
                        method.setAccessible(true);
                        method.invoke(this.val$shellListener, new Object[]{this.val$shellInstance});
                        return;
                    }
                }
            } catch (Exception e) {
                LogUtils.LogError(Convertor.TAG, "IMediaViewListener.onFullscreenForeground Exception=" + e);
            }
        }

        public void onPause(IMediaView iMediaView) {
            try {
                LogUtils.LogError(Convertor.TAG, "IMediaViewListener.onPause");
                String publicApiInterfaceMethodName = ModuleApiManager.getInstance(this.val$ctx).getPublicApiInterfaceMethodName("IMediaViewListener.onPause");
                for (Method method : this.val$shellListener.getClass().getMethods()) {
                    if (method.getName().equals(publicApiInterfaceMethodName)) {
                        method.setAccessible(true);
                        method.invoke(this.val$shellListener, new Object[]{this.val$shellInstance});
                        return;
                    }
                }
            } catch (Exception e) {
                LogUtils.LogError(Convertor.TAG, "IMediaViewListener.onPause Exception=" + e);
            }
        }

        public void onPlay(IMediaView iMediaView) {
            try {
                LogUtils.LogError(Convertor.TAG, "IMediaViewListener.onPlay");
                String publicApiInterfaceMethodName = ModuleApiManager.getInstance(this.val$ctx).getPublicApiInterfaceMethodName("IMediaViewListener.onPlay");
                for (Method method : this.val$shellListener.getClass().getMethods()) {
                    if (method.getName().equals(publicApiInterfaceMethodName)) {
                        method.setAccessible(true);
                        method.invoke(this.val$shellListener, new Object[]{this.val$shellInstance});
                        return;
                    }
                }
            } catch (Exception e) {
                LogUtils.LogError(Convertor.TAG, "IMediaViewListener.onPlay Exception=" + e);
            }
        }

        public void onVolumeChange(IMediaView iMediaView, float f) {
            try {
                LogUtils.LogError(Convertor.TAG, "IMediaViewListener.onVolumeChange");
                String publicApiInterfaceMethodName = ModuleApiManager.getInstance(this.val$ctx).getPublicApiInterfaceMethodName("IMediaViewListener.onVolumeChange");
                for (Method method : this.val$shellListener.getClass().getMethods()) {
                    if (method.getName().equals(publicApiInterfaceMethodName)) {
                        method.setAccessible(true);
                        method.invoke(this.val$shellListener, new Object[]{this.val$shellInstance});
                        return;
                    }
                }
            } catch (Exception e) {
                LogUtils.LogError(Convertor.TAG, "IMediaViewListener.onVolumeChange Exception=" + e);
            }
        }
    }

    public static IAdListener transToIAdListener(Context context, Object obj, Object obj2) {
        return new AnonymousClass1(context, obj, obj2);
    }

    public static IMediaViewListener transToIMediaViewListener(Context context, Object obj, Object obj2) {
        return new AnonymousClass4(context, obj, obj2);
    }

    public static INativeAdListener transToINativeAdListener(Context context, Object obj, Object obj2) {
        return new AnonymousClass2(context, obj, obj2);
    }

    public static IInterstitialAdListener transToInterstitialAdListener(Context context, Object obj, Object obj2) {
        LogUtils.LogError(TAG, "transToInterstitialAdListener   shellListener=" + obj);
        return new AnonymousClass3(context, obj, obj2);
    }
}
